<?php include_partial('global/navbar') ?>
<br/><br/>

<div class="next_head">
    <div class="wrap">交易明细</div>
</div>
<div class="content_nav">
    <div class="tag_nav wrap tit">
        <div class="col-xs-3 pd-n">
            <p class="tit-p p-lg">账户余额</p>
            <p class="alt-p p-lg">&#165;<?php echo number_format($user_account->getBalance(),2); ?> </p>
        </div>
        <div class="col-xs-7 pd-n">
            <div class="col-xs-3 pd-n">
                <p class="tit-p">可用资金</p>
                <p class="alt-p">&#165;<?php echo number_format($user_account->getRemainingMoney(),2); ?> </p>
            </div>
            <div class="col-xs-3 pd-n">
                <p class="tit-p">冻结资金</p>
                <p class="alt-p">&#165;<?php echo number_format($user_account->getBlockedMoney(),2); ?> </p>
            </div>
            <div class="col-xs-3 pd-n">
                <p class="tit-p">已充值总额</p>
                <p class="alt-p">&#165;<?php echo number_format($user_account->getRecharge(),2); ?> </p>
            </div>
            <div class="col-xs-3 pd-n">
                <p class="tit-p">已取现总额</p>
                <p class="alt-p">&#165;<?php echo ($cash_money['money'] > 0 ) ? number_format($cash_money['money'],2) : 0; ?> </p>
            </div>
        </div>
        <div class="col-xs-2 pd-n">
            <button type="button" class="btn btn-primary btn-block" onclick="window.location.href='<?php echo url_for('account/recharge'); ?>'">充值</button>
            <button type="button" class="btn btn-default  btn-block" onclick="window.location.href='<?php echo url_for('account/withdrawcash'); ?>'">申请提现</button>
        </div>
    </div>
    <div class="tag_nav wrap">
        <div class="col-xs-12 pd-n">
            <form class="form-inline" role="form" action="<?php echo url_for('account/details')?>" method="POST">
                <div class="form-group ft-l">
                    <label class="ft-l control-label sch-lb" for="">查询时间</label>
                    <input type="text" value="<?php if($startDate):?><?php echo $startDate?><?php endif;?>" onkeydown="return false;" onkeyup="return false;"   class="ft-l form-control sch" id="startDate" name="startDate">
                </div>
                <div class="form-group ft-l">
                    <label class="ft-l control-label sch-lb" for="">到</label>
                    <input type="text" value="<?php if($endDate):?><?php echo $endDate?><?php endif;?>" onkeydown="return false;" onkeyup="return false;"   class="ft-l form-control sch" id="endDate" name="endDate">
                </div>
                <button type="submit" class="btn btn-primary">查询</button>
                
                &nbsp;&nbsp;
                <button type="button" class="btn btn-primary" onclick="window.location.href='<?php echo url_for('account/detailsold'); ?>'">查询11月之前数据</button>
            </form>
			
        </div>
         <?php if($pager->getNbResults() >0):?>
        <div class="col-xs-12 pd-n">
            <hr />
            <table class="table table-hover ">
                <thead>
                    <tr>
                        <th>日期</th>
                        <th>类型</th>
                         <th>冻结</th>
                        <th>收入</th>
                        <th>支出</th>
                        <th>余额</th>
                        <th style="width: 280px">说明</th>
                    </tr>
                </thead>
                <tbody>
		  <?php foreach($pager->getResults() as $details): ?>
		  <tr>
		    <td><?php echo $details->getDateTimeObject('created_at')->format('Y-m-d H:i:s') ?></td>
		    <td><?php echo AccountDetails::$action_label[$details->getEvent()]; ?></td>
		    <td><?php echo number_format($details->getInOfOut('no_in_out'),2); ?></td>
		    <td><?php echo number_format($details->getInOfOut('in'),2); ?></td>
		    <td><?php echo number_format($details->getInOfOut('out'),2); ?></td>
		    <td><?php echo number_format($details->getBalance(),2); ?></td>
            <td style="width: 280px"><?php echo html_entity_decode($details->getDescription()); ?></td>
		  </tr>
		  <?php endforeach; ?>
         
          
                </tbody>
            </table>
        </div>
        <?php $uri = url_for("account/details");?>
            <ul class="pagination pagination-lg ft-r">
            <?php echo pager_navigation($pager, $uri); ?>
            </ul>
        <?php else:?>
         <div class="tag_nav wrap">
            <div class="nodata">
                该时间段无交易明细
            </div>
        </div>
        <?php endif;?>
    </div>
</div>

<script >
    $("#10003,#10007").addClass("on");
    $('#startDate').datetimepicker({
        format: 'yyyy-mm-dd',
        autoclose: true,
        minView: 'decade'
    });
    $('#endDate').datetimepicker({
        format: 'yyyy-mm-dd',
        autoclose: true,
        minView: 'decade'
    });
  
    
</script>